

#ifndef Metro_h
#define Metro_h

#include <inttypes.h>
#include "Observer/Observable.h"

#define smillis() (long(millis()))
#define ONE_SECOND (long(1000))
#define ONE_MINUTE (ONE_SECOND * 60)
#define ONE_HOUR (ONE_MINUTE * 60)

class Metro : public Observable
{

public:
  Metro(long intervalMillis);
  Metro(long intervalMillis, uint8_t autoreset);
  Metro(long intervalMillis, long startMillis);
  Metro(long intervalMillis, long startMillis, uint8_t autoreset);
  void interval(long intervalMillis);
  char check();
  void reset();
  void force();
  long getTimeoutMillis() const;
  long getStartMillis() const;
private:
  uint8_t autoreset, forced;
  long  startMillis, timeoutMillis, intervalMillis;
  void init(long intervalMillis, long startMillis, uint8_t autoreset);

};

#endif


